/** *******************************************************************

 * Copyright (c) 2008 Jonnie Spratley. All Rights Reserved.
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 * @internal
 ******************************************************************* */
package com.jonniespratley.codegen.vo
{
	import mx.collections.ArrayCollection;
	

	[Bindable]
	public class Database extends Object
	{
		public var name:String;
		public var tables:ArrayCollection;
		
		public function  Database( obj:Object = null )
		{
			if ( obj != null )
			{
				this.name = obj['label'];
				
				var tempArray:Array = obj['children'] as Array;
				var tempAc:ArrayCollection = new ArrayCollection();
			
				for ( var s:String in tempArray )
				{
					tempAc.addItem( new Table( tempArray[ s ] ) );
				}
				this.tables = tempAc;
			}
		}
		public function get label():String{
			return this.name;
		}
		public function get children():Array{
			return this.tables.toArray();
		}
	}
}